﻿using BussinessObject.ObjectTwo;
using DataAccess.ObjectTwo;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ProjectHK3.Object_One
{
    public partial class FindAccount : System.Web.UI.Page
    {
        B_FindAccount ex = new B_FindAccount();
        DataTable tb = new DataTable();
        D_GetAccount sx = new D_GetAccount();
        B_Delete gx = new B_Delete();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
               tb = ex.loadFindAccount();
               _grwAccountsList.DataSource = tb;
               _grwAccountsList.DataBind();
            }
        }

        protected void _grwAccountsList_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        protected void _lbtProfileAccount_Click(object sender, EventArgs e)
        {

        }

        protected void _lbtDelete_Command(object sender, CommandEventArgs e)
        {
            if (e.CommandName == "RemoveAccount")
            {
                gx.DeleteAccount(Convert.ToInt32(e.CommandArgument.ToString()));
                Response.Redirect("../Object One/FindAccount.aspx");
            }
        }

        protected void _lbtDetails_Command(object sender, CommandEventArgs e)
        {
            Session["Account_id"] = e.CommandArgument.ToString();
            Response.Redirect("../Object One/EmpoyeeDetail.aspx"); 
        }

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
           tb = sx.SearchAccount(TextBox1.Text);
           _grwAccountsList.DataSource = tb;
           _grwAccountsList.DataBind();
        }

        protected void _grwAccountsList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {

        }
    }
}